package com.logansoft.zhxypkoa.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import lombok.Data;

/**
 * 基础模型
 * 
 * @author zhuyj
 *
 */
@Data
@MappedSuperclass
public abstract class Base implements Serializable {

  /**
   * 
   */
  private static final long serialVersionUID = 1L;
  /** id */
  @Id
  @GeneratedValue(generator = "system-uuid")
  @GenericGenerator(name = "system-uuid", strategy = "uuid")
  @Column(name = "ID", columnDefinition = "varchar(32) COMMENT 'ID'")
  protected String id;// ID
  /** 创建时间 */
  @Column(name = "CREATED_AT")
  @Temporal(TemporalType.TIMESTAMP)
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  protected Date createdAt;
  /** 创建人 */
  @Column(name = "CREATED_By", length = 32)
  protected String createdBy;
  /** 更新时间 */
  @Column(name = "UPDATED_AT")
  @Temporal(TemporalType.TIMESTAMP)
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  protected Date updatedAt;
  /** 更新人 */
  @Column(name = "UPDATED_By", length = 32)
  protected String updatedBy;
  /** ״̬ */
  @Column(name = "STATUS")
  @Enumerated(EnumType.ORDINAL)
  protected Status status = Status.NORMAL;
  /** 手动排序 */
  @Column(name = "")
  protected int num;
  /** 名称 */
  @Column(name = "NAME", length = 128)
  protected String name;
  /** 描述 */
  @Column(name = "DESCRIPTION", length = 512)
  protected String description;
}
